<?php

require('config.php');

if(!isset($_SESSION['id_user']))
    redirectFront('connexion');

if($_GET['id']!=null && $_GET['id']>0){
	if(onlyNumber($_GET['id'])){
		$location = modelLocationMap::getList($_GET['id']);
		if(!$location) redirectFront(LANGUAGE_FOLDER."/index");
	}
	else
		redirectFront(LANGUAGE_FOLDER."/index");
}
else
	redirectFront(LANGUAGE_FOLDER."/index");

$_SESSION['new_message'] = modelUser::hasNewMessage($_SESSION['id_user']);
if(isset($_POST['finish'])) {
	unset($_SESSION['id_property']);
	$html_name = $location->url_rewriting.'-'.$location->language_link.'.html';
	redirectFrontHtml($html_name);
}
$page = new rootLayoutPage();

$page->setBaliseTitle('upload_photo_balise');
$page->setDescription('upload_photo_description');
$page->addStyleSheet('jQuery.swfupload.progress.css');
$page->addJavaScript('swfUpload/jquery.swfupload.js');
$page->addJavaScript('swfUpload/swfupload.js');
$page->addJavaScript('swfUpload/multi_upload_file.js');

$page->addJavaScript('ajaxUpload.js');
//-- menu Left show products--------------------------------//
$menu = new layoutMenuLeft();
$menuCategorie = new layoutMenuPage();
$menu->pushMenu($menuCategorie);
$menuPage = new layoutMenuPage();
$menu->pushMenu($menuPage);
$page->setMenuPage($menu);

$tpl_file='upload-photo-video.tpl';
$upload_photo = new flyLayout(REP_TPL . $tpl_file);
$upload_photo->start();

	$upload_photo->setVariable('ajax_upload_file', REP_AJAX.'upload/upload_multi_file.php');
	$upload_photo->setVariable('ajax_upload_save', REP_AJAX.'upload/upload_multi_file_save.php');

	$upload_photo->setVariable('ajax_upload_file_video', REP_AJAX.'upload/upload_multi_file_video.php');
	$upload_photo->setVariable('ajax_upload_save_video', REP_AJAX.'upload/upload_multi_file_save_video.php');

    $upload_photo->setVariable('max_file_size_upload', MAX_FILE_SIZE_UPLOAD);
    $upload_photo->setVariable('max_file_size_upload_video', MAX_FILE_SIZE_UPLOAD_VIDEO);

    $upload_photo->setVariable('id_repertoire', ID_REP_PHOTO);
    $upload_photo->setVariable('id_repertoire_video', ID_REP_VIDEO);
    $upload_photo->setVariable('id_map', $_GET['id']);
    $upload_photo->setVariable('place_name', $location->name_place);

    $upload_photo->setVariable('rep_type_mime', REP_AJAX.'get_type_file.php');
    $upload_photo->setVariable('rep_ajax_photo', REP_AJAX.'location_photo_upload.php');
    $upload_photo->setVariable('rep_ajax_video', REP_AJAX.'location_video_upload.php');
    $upload_photo->setVariable('rep_id_photo', ID_REP_PHOTO);
    $upload_photo->setVariable('rep_id_video', ID_REP_VIDEO);

    $upload_photo->setVariable('id_location', $_GET['id']);

$upload_photo->stop();
$page->setBody($upload_photo);
$page->display();

?>